package com.dj.mingkong.portal.biz.repository.database.music;

import com.dj.mingkong.common.infrastructure.base.dto.query.QueryVo;
import com.dj.mingkong.common.infrastructure.base.repository.BaseDatabaseRepository;
import com.dj.mingkong.common.infrastructure.eo.database.music.MusicVisitEo;
import com.dj.mingkong.portal.biz.repository.database.music.mapper.MusicVisitMapper;
import org.springframework.stereotype.Repository;

import java.util.Optional;

/**
 * 音乐访客repository
 *
 * @author zenglonghui
 * @date: 2022/8/21 13:45
 */
@Repository
public class MusicVisitRepository extends BaseDatabaseRepository<MusicVisitMapper, MusicVisitEo, QueryVo> {
    public Optional<MusicVisitEo> oneOptByUserIdAndMusicId(Long userId, Long musicId) {
        return lambdaQuery()
                .eq(MusicVisitEo::getUserId, userId)
                .eq(MusicVisitEo::getMusicId, musicId)
                .oneOpt();
    }
}
